﻿//using System;
//using Unity.Burst;
//using Unity.Collections;
//using Unity.Entities;
//using Unity.Physics;
//using Unity.Physics.Systems;
//using UnityEngine;


//struct FilterTriggerPairsJob : IBodyPairsJob
//{
//    [ReadOnly] public PhysicsWorld PhysicsWorld;
//    public int NumDynamicBodies;

//    public unsafe void Execute(ref ModifiableBodyPair pair)
//    {
//        // 获取碰撞对实体
//        //Entity entityA = PhysicsWorld.Bodies[pair.BodyIndexA].Entity;
//        Entity entityA = pair.EntityA;
//        //Entity entityB = PhysicsWorld.Bodies[pair.BodyIndexB].Entity;
//        Entity entityB = pair.EntityB;


//        pair.Disable();
//    }
//}


//[RequireMatchingQueriesForUpdate]
//[UpdateInGroup(typeof(PhysicsSimulationGroup))]
//[UpdateAfter(typeof(PhysicsCreateBodyPairsGroup))]
//[UpdateBefore(typeof(PhysicsCreateContactsGroup))]
//public partial struct FilterTriggerSystem : ISystem
//{
//    private ComponentLookup<PlayerTag> _playerTags;
//    private ComponentLookup<EnemyTag> _enemyTags;


//    [BurstCompile]
//    public void OnCreate(ref SystemState state)
//    {
//        state.RequireForUpdate<SimulationSingleton>();
//        state.RequireForUpdate<PhysicsWorldSingleton>();
//        _playerTags = state.GetComponentLookup<PlayerTag>(true);
//        _enemyTags = state.GetComponentLookup<EnemyTag>(true);
//    }

//    [BurstCompile]
//    public void OnUpdate(ref SystemState state)
//    {
//        var simulation = SystemAPI.GetSingleton<SimulationSingleton>();
//        if (simulation.Type == SimulationType.NoPhysics) return;

//        var physicsWorld = SystemAPI.GetSingletonRW<PhysicsWorldSingleton>().ValueRW.PhysicsWorld;

//        _playerTags.Update(ref state);
//        _enemyTags.Update(ref state);

//        state.Dependency = new FilterTriggerPairsJob
//        {
//            PhysicsWorld = physicsWorld,
//            NumDynamicBodies = physicsWorld.NumDynamicBodies
//        }.Schedule(simulation, ref physicsWorld, state.Dependency);
//    }
//}